package struts.actionForm.entreprise;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class BeanConnexionEntreprise extends ActionForm 
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	String login=null;
	String mdp=null;
	
	public String getLogin() 
	{
		return login;
	}
	
	public void setLogin(String login) 
	{
		this.login = login;
	}
	
	public String getMdp()
	{
		return mdp;
	}
	
	public void setMdp(String mdp) 
	{
		this.mdp = mdp;
	}
	
	@Override
	public ActionErrors validate(ActionMapping mapping,	HttpServletRequest request)
	{
		ActionErrors erreurs =new ActionErrors();
		if((getLogin()=="")||(getLogin()==null))
		{
			erreurs.add("login_vide", new ActionMessage("Entreprise.erreurs.loginRequis"));
		}
		if(((getMdp()=="")||(getMdp()==null)))
		{
			erreurs.add("mo_de_passe_vide", new ActionMessage("Entreprise.erreurs.mdpRequis"));
		}
		request.getSession().setAttribute("message", null);
		return erreurs;
	}

}
